package com.fdb.efp.flow.enumeration;

import java.util.Arrays;
import java.util.Objects;

import com.fdb.basic.framework.core.util.StringUtil;

/**
 * 
 * 插件类型对应的BEAN
 * 
 * @author Cytus_
 * @since 2018年5月14日 下午2:35:32
 * @version 1.0
 *
 */
public enum PluginTypeBean {

	S("servicePluginTaskExecutor"), 
	V("viewPagePluginTaskExecutor"),
	A("addPagePluginTaskExecutor"),
	U("updatePagePluginTaskExecutor");
	
	private String value;
	
	private PluginTypeBean(String value) {
		this.value = value;
	}
	
	public String getValue() {
		return value;
	}
	
	public static PluginTypeBean getPluginTypeBean(String pluginType) {
		if (StringUtil.isNotEmpty(pluginType)) {
			return Arrays.stream(PluginTypeBean.values()).filter(s -> pluginType.toUpperCase().equals(s.toString())).findFirst().orElse(null);
		}
		return null;
	}
	
	public static String getPluginTypeBeanValue(String pluginType) {
		PluginTypeBean typeBean = getPluginTypeBean(pluginType);
		if (Objects.nonNull(typeBean))
			return typeBean.getValue();
		return null;
	}
}
